#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	///*int i;
	//i--;
	//if (i > sizeof(i))
	//{
	//	printf(">\n");
	//}
	//else
	//{
	//	printf("<\n");
	//}*/

	//int i = 1;
	//int ret = (++i);
	//    ret = ret+(++i);
	//	ret= ret+(++i);
	//printf("ret=%d\n", ret);



	int M = 0;
	int N = 0;
	scanf("%d %d", &M, &N);
	int arr[10][10] = { 0 };
	int i = 0;
	int j = 0;
	int sum = 0;
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < M; j++)
		{
			scanf("%d ", &arr[i][j]);
			if (arr[i][j] > 0)
			{
				sum += arr[i][j];
			}
		}
	}
		printf("%d\n",sum);
	
	return 0;

	

}